using System;
using System.ComponentModel;
using System.Collections.Generic;

using Castle.ActiveRecord;

/// <summary>
/// Business entity class generated from GenericData
/// </summary>
/// <remarks>
/// Created by: huanhvhd
/// Created date: [2011-04-23]
/// </remarks>
namespace TVN.ShopMan.ActiveModels
{
	[ActiveRecord("GenericData")]
	public partial class GenericData : ActiveRecordBase<GenericData>
	{
		#region Properties
		
        /// <summary>
        /// All properties
        /// </summary>
		public class Properties
		{
			public const string Id = "Id";
			public const string Name = "Name";
			public const string DataType = "DataType";
			public const string CreatedDate = "CreatedDate";
			public const string LastModifiedDate = "LastModifiedDate";
			public const string Creator = "Creator";
			public const string LastModifier = "LastModifier";
			public const string Parent = "Parent";
		}

		#endregion

		#region Private fields

		private int _id;
		private string _name;
		private string _dataType;
		private DateTime _createdDate;
		private DateTime? _lastModifiedDate;
		private Account _creatorId;
		private Account _lastModifierId;
		private GenericData _parentId;

		private IList<GenericData> _genericDatasParentId = new List<GenericData>();

		#endregion

		#region Constructors

		public GenericData()
		{
		}

		#endregion

		#region Properties

		[PrimaryKey("Id", Access = PropertyAccess.NosetterLowercaseUnderscore)]
		public int Id
		{
			get { return _id; }
		}

		[Property("Name", NotNull = true, Length = 1024)]
		public string Name
		{
			get { return _name; }
			set { _name = value; }
		}

		[Property("DataType", NotNull = true, Length = 32)]
		public string DataType
		{
			get { return _dataType; }
			set { _dataType = value; }
		}

		[Property("CreatedDate", NotNull = true)]
		public DateTime CreatedDate
		{
			get { return _createdDate; }
			set { _createdDate = value; }
		}

		[Property("LastModifiedDate")]
		public DateTime? LastModifiedDate
		{
			get { return _lastModifiedDate; }
			set { _lastModifiedDate = value; }
		}

		[BelongsTo("CreatorId", Type = typeof(Account))]
		public Account Creator
		{
			get { return _creatorId; }
			set { _creatorId = value; }
		}

		[BelongsTo("LastModifierId", Type = typeof(Account))]
		public Account LastModifier
		{
			get { return _lastModifierId; }
			set { _lastModifierId = value; }
		}

		[BelongsTo("ParentId", Type = typeof(GenericData))]
		public GenericData Parent
		{
			get { return _parentId; }
			set { _parentId = value; }
		}

		[HasMany(typeof(GenericData), Table="GenericData", ColumnKey="ParentId")]
		public IList<GenericData> GenericDatasParentId
		{
			get { return _genericDatasParentId; }
			set { _genericDatasParentId = value; }
		}
		#endregion

	} }
